using Assets.Scripts.GDK;
using System;
using UnityEngine;

namespace Brick
{
	public class StartScene : gdk_base_scene
	{
		public override void OnStart()
		{
			//UnityEngine.Debug.Log("StartScene OnStart!");
			//if (GameData.gameConfig.isDebug)
			//{
			//	Utils.addDebugBtn(delegate
			//	{
			//		gdk_game_manager.showDebug(DebugID.GAME_DEBUG);
			//	}).SetParent(base.gameObject.transform, worldPositionStays: true);
			//}
			//UnityEngine.Debug.Log("StartScene 完成!");
			//GDK.ModuleManger.Module<AdvansBoxMoudle>().GetRealSize();
			//GDK.ModuleManger.Module<AdvansBoxMoudle>().GetScale();
			//UnityEngine.Debug.Log("StartScene 完成!1");
			//checkSignDay();
		}

		//public void checkSignDay()
		//{
		//	if (GameData.dayFirstLogin == 0)
		//	{
		//		GameData.dayFirstLogin = (int)ConvertDateTimeToLong(DateTime.Now);
		//		GameData.buyWeekGift = false;
		//		gdk_game_manager.log("首次重置周礼包");
		//		return;
		//	}
		//	DateTime dateTime = ConvertLongToDateTime(GameData.dayFirstLogin);
		//	if (dateTime.Day == DateTime.Now.Day)
		//	{
		//		gdk_game_manager.log("当天不重置周礼包");
		//		return;
		//	}
		//	if (DateTime.Now.DayOfYear - dateTime.DayOfYear >= 7)
		//	{
		//		GameData.buyWeekGift = false;
		//		gdk_game_manager.log("大于7天重置周礼包");
		//	}
		//	else if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday)
		//	{
		//		GameData.buyWeekGift = false;
		//		gdk_game_manager.log("SUNDAY重置周礼包");
		//	}
		//	else if (DateTime.Now.DayOfWeek - dateTime.DayOfWeek < 0)
		//	{
		//		GameData.buyWeekGift = false;
		//		gdk_game_manager.log("下周重置周礼包");
		//	}
		//	else
		//	{
		//		gdk_game_manager.log("不重置周礼包");
		//	}
		//	GameData.dayFirstLogin = (int)ConvertDateTimeToLong(DateTime.Now);
		//	gdk_game_manager.log("GameData.dayFirstLogin:" + GameData.dayFirstLogin);
		//}

		private DateTime ConvertLongToDateTime(long timeStamp)
		{
			DateTime dateTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
			long ticks = long.Parse(timeStamp + "0000000");
			TimeSpan value = new TimeSpan(ticks);
			return dateTime.Add(value);
		}

		private long ConvertDateTimeToLong(DateTime time)
		{
			DateTime d = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
			return (long)(time - d).TotalSeconds;
		}
	}
}

